<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            margin: 0;
            padding: 0;
            background-image: url('../00-images/grid.png');
        }
        #canvas{
            background-color: rgba(255,0,0,.4);
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="300px" height="300px"></canvas>
    <script>
        //获取canvas元素
        window.onload = ()=>{
            const item = document.getElementById('canvas');
            console.log(item);
            let context = item.getContext('2d');
            if(!context)
            {
                 return;
            }
            // // context.fillStyle = 'red'

            // context.fillRect(0,0,100,100);
        }
    </script>
</body>
</html>